<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>易渔 - 发布新帖</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="icon" href="assets/logo/logo.png">
    <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=aa40a1d28dcb61b07f91f246b65592d9"></script>
</head>

<body class="bg-gray-100">
    <div id="particles-js" class="fixed w-full h-full top-0 left-0 z-0"></div>

    <div class="container mx-auto px-4 py-8 relative z-10">
        <header class="text-center mb-8">
            <h1 class="text-4xl font-bold text-blue-600 mb-2">易渔</h1>
            <p class="text-lg text-gray-600">分享您的钓鱼乐趣与经验</p>
        </header>

        <div class="bg-white rounded-lg shadow-lg p-6 max-w-4xl mx-auto">
            <h2 class="text-2xl font-bold text-gray-800 mb-6 border-b pb-2">发布新帖</h2>

            <form id="post-form" class="space-y-6">
                <div class="form-group">
                    <label for="post-title" class="block text-sm font-medium text-gray-700 mb-1">标题</label>
                    <input type="text" id="post-title" name="title"
                        class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
                        placeholder="请输入标题" required>
                </div>

                <div class="form-group">
                    <label for="post-content" class="block text-sm font-medium text-gray-700 mb-1">内容</label>
                    <textarea id="post-content" name="content" rows="6"
                        class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500"
                        placeholder="分享您的钓鱼经历..." required></textarea>
                </div>

                <div class="form-group">
                    <label class="block text-sm font-medium text-gray-700 mb-1">标签</label>
                    <div class="tags-container flex flex-wrap gap-2 mb-2">
                        <span
                            class="tag-item bg-blue-100 text-blue-700 px-3 py-1 rounded-full text-sm cursor-pointer hover:bg-blue-200 transition">淡水鱼
                            <i class="fas fa-times ml-1"></i></span>
                        <span
                            class="tag-item bg-green-100 text-green-700 px-3 py-1 rounded-full text-sm cursor-pointer hover:bg-green-200 transition">海钓
                            <i class="fas fa-times ml-1"></i></span>
                    </div>
                    <div class="flex">
                        <select id="tag-select"
                            class="flex-grow px-3 py-2 border border-gray-300 rounded-l-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
                            <option value="">选择标签...</option>
                            <option value="淡水鱼">淡水鱼</option>
                            <option value="海钓">海钓</option>
                            <option value="路亚">路亚</option>
                            <option value="台钓">台钓</option>
                            <option value="装备">装备</option>
                            <option value="技巧">技巧</option>
                            <option value="钓场">钓场</option>
                            <option value="渔获">渔获</option>
                        </select>
                        <button type="button" id="add-tag-btn"
                            class="px-4 py-2 bg-blue-500 text-white rounded-r-md hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50">添加</button>
                    </div>
                    <input type="hidden" id="post-tags" name="tags" value="">
                </div>

                <div class="form-group">
                    <label class="block text-sm font-medium text-gray-700 mb-1">上传图片/视频</label>
                    <div class="flex flex-col space-y-2">
                        <div class="flex items-center">
                            <input type="file" id="media-upload" name="media" class="sr-only" accept="image/*,video/*"
                                multiple>
                            <label for="media-upload"
                                class="cursor-pointer bg-gray-50 border border-dashed border-gray-300 rounded-md px-4 py-6 w-full flex flex-col items-center justify-center hover:bg-gray-100 transition">
                                <i class="fas fa-cloud-upload-alt text-3xl text-gray-400 mb-2"></i>
                                <span class="text-gray-600">点击上传图片或视频</span>
                                <span class="text-xs text-gray-500 mt-1">支持jpg、png、gif、mp4格式</span>
                            </label>
                        </div>

                        <div id="media-preview" class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 mt-2"></div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="block text-sm font-medium text-gray-700 mb-1">位置信息</label>
                    <div class="flex items-center space-x-2">
                        <button type="button" id="get-location-btn"
                            class="flex items-center px-3 py-2 bg-green-500 text-white rounded-md hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-opacity-50">
                            <i class="fas fa-map-marker-alt mr-1"></i>
                            获取当前位置
                        </button>
                        <span id="location-info" class="text-gray-600 text-sm">未获取位置信息</span>
                        <input type="hidden" id="location-lat" name="latitude">
                        <input type="hidden" id="location-lng" name="longitude">
                        <input type="hidden" id="location-address" name="address">
                    </div>
                </div>

                <!-- 原发布按钮区域 -->
                <div class="form-group mt-8">
                    <!-- 修改为flex布局，添加取消按钮 -->
                    <div class="flex space-x-4">
                        <button type="submit" id="submit-btn"
                            class="w-full sm:w-auto px-6 py-3 bg-blue-600 text-white font-medium rounded-md shadow hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 transition-all duration-200">
                            <i class="fas fa-paper-plane mr-2"></i>发布帖子
                        </button>
                        <button type="button" id="cancel-btn"
                            class="w-full sm:w-auto px-6 py-3 bg-gray-300 text-gray-700 font-medium rounded-md shadow hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-opacity-50 transition-all duration-200">
                            <i class="fas fa-times mr-2"></i>取消
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <div id="post-success"
            class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
            <div class="bg-white rounded-lg p-8 max-w-md">
                <div class="text-center">
                    <i class="fas fa-check-circle text-5xl text-green-500 mb-4"></i>
                    <h2 class="text-2xl font-bold mb-2">发布成功！</h2>
                    <p class="text-gray-600 mb-6">您的帖子已成功发布到钓友圈</p>
                    <div class="flex justify-center space-x-4">
                        <button id="view-post-btn"
                            class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600">查看帖子</button>
                        <button id="new-post-btn"
                            class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300">继续发帖</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="bg-gray-800 text-white py-8 mt-12">
        <div class="container mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h4 class="text-lg font-bold mb-4">关于我们</h4>
                    <p class="text-gray-400">钓鱼天堂是一个致力于为钓鱼爱好者提供交流平台和专业装备的综合性网站。</p>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">快速链接</h4>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="index.html" class="hover:text-white transition">首页</a></li>
                        <li><a href="forum.html" class="hover:text-white transition">论坛</a></li>
                        <li><a href="mall.html" class="hover:text-white transition">商城</a></li>
                        <li><a href="auth.html" class="hover:text-white transition">注册/登录</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">联系我们</h4>
                    <ul class="space-y-2 text-gray-400">
                        <li><i class="fas fa-envelope mr-2"></i> contact@fishingheaven.com</li>
                        <li><i class="fas fa-phone mr-2"></i> 400-123-4567</li>
                        <li><i class="fas fa-map-marker-alt mr-2"></i> 渔乐路88号钓鱼天堂大厦</li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-lg font-bold mb-4">关注我们</h4>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-weixin"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-weibo"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-qq"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white text-xl transition"><i
                                class="fab fa-tiktok"></i></a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 mt-8 pt-6 text-center text-gray-400">
                <p>&copy; 2025 钓鱼天堂 版权所有 | 钓友们的网上家园</p>
            </div>
        </div>
    </footer>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/particles.js/2.0.0/particles.min.js"></script>
    <script src="js/app.js"></script>
    <script src="./js/childJS/putPostChild.js"></script>
</body>

</html>